﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Triunfadores.BusinessEntities
{
    public partial class DetalleVentaAccion:IEquatable<DetalleVentaAccion>
    {
        //solo para genrar la base de datos
        //public Int32 Id { get; set; }
        public int Cantidad { get; set; }

        public virtual Accion Accion { get; set; }
        public int AccionId { get; set; }

        public virtual VentaAccion VentaAccion { get; set; }
        public int VentaAccId { get; set; }

        public bool Equals(DetalleVentaAccion other)
        {
            if (object.ReferenceEquals(other, null)) return false;
            if (object.ReferenceEquals(this, other)) return true;

            return AccionId.Equals(other.AccionId) && VentaAccId.Equals(other.VentaAccId);
        }

        public override int GetHashCode()
        {
            return VentaAccId.GetHashCode() * AccionId.GetHashCode();
        }

        public decimal Monto { get { return Cantidad * Accion.Precio; } }
    }
}
